#ifndef __SCREEN_H__
#define __SCREEN_H__

#include "Button.h"
#include <list>

class Screen : public ButtonDelegate
{
public:
	Screen();																				// Constructor.
	virtual ~Screen();																		// Destructor.

	virtual void draw(sf::RenderWindow* win) = 0;											// Draws all of the objects on the screen.
	virtual void update(float dt) = 0;														// Updates the game screen and all the objects on it.
	virtual bool showLoadingScreen() = 0;													// Returns true if the the loading screen should show before this screen.

	void loadResources();																	// Loads the resources for the screen to use.

	void drawButtons(sf::RenderWindow* win);												// Draws the buttons added to this screen object.
	bool addButton(Button* button);															// Adds a button to this screen (adopts responsibility of button memory management.)

	bool keyPressed(sf::Keyboard::Key key);													// Called when a key is pressed and the screen is foremost.
	bool mouseUp(sf::Mouse::Button button, sf::Vector2i mousePosition);						// Called when a mouse button is released within the screen.
	bool mouseDown(sf::Mouse::Button button, sf::Vector2i mousePosition);					// Called when a mouse button is pressed within the screen.
	bool mouseMoved(sf::Vector2i oldPosition, sf::Vector2i newPosition);					// Called when the mouse is moved by the user.
protected:
	virtual void onLoadResources() = 0;														// Called by the ScreenMgr, loads the resources for the screen.
	virtual bool onKeyPressed(sf::Keyboard::Key key) = 0;									// Called by the ScreenMgr, handles key presses from the user.
	virtual bool onMouseUp(sf::Mouse::Button button, sf::Vector2i mousePosition) = 0;		// Called by the ScreenMgr, handles mouse up events from the user.
	virtual bool onMouseDown(sf::Mouse::Button button, sf::Vector2i mousePosition) = 0;		// Called by the ScreenMgr, handles mouse down events from the user.
	virtual bool onMouseMoved(sf::Vector2i oldPosition, sf::Vector2i newPosition) = 0;		// Called by the ScreenMgr, handles mouse moves events from the user.
private:
	std::list<Button*> m_buttons;															// Buttons owned by this screen object.
};

#endif // __SCREEN_H__